package com.chaoxuan.uebt.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.chaoxuan.uebt.R;
import com.chaoxuan.uebt.utils.Const;

public class StoreSuccessActivity extends BaseActivity implements View.OnClickListener{
    String id,title,pay;
    int type;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_success);
        initTitle();
        TextView tvTitle=(TextView) findViewById(R.id.tv_order_title);
        TextView tvPay=(TextView)findViewById(R.id.tv_store_pay);
        Button button=(Button)findViewById(R.id.btn_query);
        button.setOnClickListener(this);
        Intent i= getIntent();
        title=i.getStringExtra("title");
        pay=i.getStringExtra("pay");
        id=i.getStringExtra("id");
        type=i.getIntExtra("type",0);
        tvTitle.setText("你已成功兑换:"+title);
        tvPay.setText(pay);
        button.setText(type==1?"查看订单":"查看卡密");
        findViewById(R.id.btn_index).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_index:
                Const.TAB=1;
                startActivity(new Intent(this,MainActivity.class));
                finish();
                break;
            case R.id.btn_query:
                Intent i=new Intent(this,OrderDetailActivity.class);
                i.putExtra("id",id);
                startActivity(i);
                break;

        }
    }


}
